<%@ Language=VBScript%>
<%
	Session("FormName")="F15"
%>
<!--#include file=..\checkSession.inc-->
<!--#include file=..\getFormName.inc-->
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>CẬP NHẬT NHÓM LÀM VIỆC</title>
</head>
<!--#include file=..\jvGrid.inc-->
<%		
	'set Conn=server.CreateObject("ADODB.Connection")
	'conn.Open Application("StrConn")
	
	Set ClsFun =server.CreateObject("Vinalines.ClsFunction")		

	CheckAdd=request.form("CheckAdd")
	
	bComm=Request("bComm")
	bMa=Request("bMa")
	Loaitim=request("Loaitim")
	bsearch=request("Txtten")

	if bComm="display" then
		sSQL="Select * from doitac_nguoi where IDDoitac=" & cstr(bMa)
		Set RecDisplay=server.CreateObject("ADODB.Recordset")
		RecDisplay.CursorType=3
		RecDisplay.CacheSize=5
		RecDisplay.Open sSQL,Conn
		if RecDisplay.RecordCount then
			bMa=trim(RecDisplay("IDDoitac"))
			bTen=trim(RecDisplay("Ten"))
			bChucvu=trim(RecDisplay("Chucvu"))
			bPhone=trim(RecDisplay("Phone"))
			bTochuc=trim(RecDisplay("Thuoctochuc"))
			bEmail=trim(RecDisplay("Email"))
		end if
		RecDisplay.Close
		set RecDisplay=nothing
	end if	
	Dim bTempComm
	dim bMsg
	Dim Msg	
	if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin") then	
		Select Case bComm
			Case "add"
				bTen=Request("TxtTen")
				bChucvu=Request("TxtChucvu")
				bPhone=Request("TxtPhone")
				bTochuc=Request("TxtTochuc")
				bEmail=Request("TxtEmail")
				sSQL="Insert into Doitac_nguoi(ten,Chucvu,phone,thuoctochuc,email)values('"& ClsFun.ModiString(bTen) &"','"& ClsFun.ModiString(bChucvu) &"','"& ClsFun.ModiString(bPhone) &"','"& ClsFun.ModiString(bTochuc) &"','"& ClsFun.ModiString(bEmail) &"')"
				Conn.Execute sSQL	
			case "delete"							
				sSQL="Delete from Doitac_nguoi Where IDDoitac Like "& cstr(bMa)
				Conn.Execute sSQL	
			case "edit"
				bTen=Request("TxtTen")
				bChucvu=Request("TxtChucvu")
				bPhone=Request("TxtPhone")
				bTochuc=Request("TxtTochuc")
				bEmail=Request("TxtEmail")
				sSQL="Update Doitac_nguoi set thuoctochuc='"& ClsFun.ModiString(bTochuc) _
					&"',ten='"& ClsFun.ModiString(bTen) _
					&"',Chucvu='"& ClsFun.ModiString(bChucvu) _
					&"',phone='"& ClsFun.ModiString(bPhone) _				
					&"',email='"& ClsFun.ModiString(bEmail) _
					&"' Where IDDoitac Like '" & ClsFun.ModiString(bMa) & "'"
				Conn.Execute sSQL		
		End Select
	End if
	Set Rec=server.CreateObject("ADODB.Recordset") 
	rec.CursorType = 3
	rec.CacheSize=5		
	select case bComm
		case "search"	
			ssql="Select * from Doitac_nguoi where Ten like '%"& ClsFun.ModiString(bsearch) & "%' order by IDDoitac"
		case else
			Loaitim=""
			bsearch=""
			ssql="Select * from Doitac_nguoi order by IDDoitac"
	end select
	Dim nRecCount	' Number of records found
	Dim nPageCount	' Number of pages of records we have
	Dim nPage	' Current page number
	nPage=CLng(request("Page"))	
	if nPage="" then nPage=1
	rec.Open ssql,Conn
	if  rec.EOF and rec.BOF then
		nPageCount=0
	end if	
%>
<!--#include file="..\jvfunction.inc"-->
<script language=VBScript runat=server>
	Function KTTen(bValue)
		KTTen=false
		ssql="Select * from doitac where Tendoitac like '"& ClsFun.ModiString(bValue) &"'"
		Set RecTemp=server.CreateObject("ADODB.Recordset") 
		RecTemp.Open ssql,Application("StrConn")
		if (not rectemp.BOF) and (not RecTemp.EOF) then
			KTTen=True
		end if
		Set  RecTemp=nothing
	End function		
Function Paging(ByVal intPage, ByVal intPageCount, ByVal intRecordCount)
	Dim strQueryString
	Dim strScript
	Dim intStart
	Dim intEnd
	Dim strRet
	Dim i

	If intPage > intPageCount Then
		intPage = intPageCount
	ElseIf intPage < 1 Then 
		intPage = 1
	End If
	
	If intRecordCount = 0 Then
		'strRet = "No Records Found"
	ElseIf intPageCount = 1 Then
		'strRet = "End Of Hits"
	Else
		For i = 1 To Request.QueryString.Count
			If LCase(Request.QueryString.Key(i)) <> "page" Then
				strQueryString = strQueryString & "&" 
				strQueryString = strQueryString & Server.URLEncode(Request.QueryString.Key(i)) & "=" 
				strQueryString = strQueryString & Server.URLEncode(Request.QueryString.Item(i))
			End If
		Next

		For i = 1 To Request.Form.Count
			If LCase(Request.Form.Key(i)) <> "page" Then
				strQueryString = strQueryString & "&" 
				strQueryString = strQueryString & Server.URLEncode(Request.Form.Key(i)) & "=" 
				strQueryString = strQueryString & Server.URLEncode(Request.Form.Item(i))
			End If
		Next

		If Len(strQueryString) <> 0 Then
			strQueryString = "?" & Mid(strQueryString, 2) & "&"
		Else
			strQueryString = "?"
		End If

		strScript = Request.ServerVariables("SCRIPT_NAME") & strQueryString
	
		If intPage <= 10 Then
			intStart = 1
		Else
			If (intPage Mod 10) = 0 Then
				intStart = intPage - 9
			Else
				intStart = intPage - (intPage Mod 10) + 1
			End If
		End If

		intEnd = intStart + 9
		If intEnd > intPageCount Then intEnd = intPageCount
	
		'strRet = "Page " & intPage & " of " & intPageCount & ": "
	
		If intPage > 10 Then 
			strRet = strRet & "<a href=""" & strScript
			strRet = strRet & "page=" & intPage - 10 
			strRet = strRet & """><IMG border=0 SRC=../images/prev.gif></a> "
		End If
	
		For i = intStart To intEnd
			If i = intPage Then
				strRet = strRet & "<b><font color=A90A08>" & i & "</font></b> "
			Else
				strRet = strRet & "<a href=""" & strScript
				strRet = strRet & "page=" & i 
				strRet = strRet & """>" & i & "</a>"
				If i <> intEnd Then strRet = strRet & " "
			End If
		Next
	
		If intPage <> intPageCount and intPageCount > 10 Then
			strRet = strRet & " <a href=""" & strScript
			strRet = strRet & "page=" & intPage + 10 
			strRet = strRet & """><IMG border=0 SRC=../images/next.gif></a> "
		End If
	End If
	
	Paging = strRet
End Function
</script>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>

function SetFocus(){
	if (!nhom.TxtTen.disabled){
		document.nhom.TxtTen.focus();
	}else{
		document.nhom.CmdSearch.focus();
	}
}

function CmdAdd_onclick() {	
	nhom.TxtTen.value="";
	nhom.TxtChucvu.value="";
	nhom.TxtPhone.value="";
	nhom.TxtTochuc.value="";
	nhom.TxtEmail.value="";
	nhom.sua.value=2;
	cmdenable(false);	

	nhom.CheckAdd.disabled=false;
	nhom.CheckAdd.checked=true;
	
	Unlockdata();
	nhom.TxtTen.focus();	
}
function KTnhap(){	
	if (nhom.TxtTen.value==""){
		alert("Bạn cần phải nhập tên");
		nhom.TxtTen.focus();
		return false;
	}
	return true;
}
function cmdenable(bvalue){
	if (bvalue){
		if ("<%= Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)%>"=='1'||"<%= Session("IsAdmin") %>".toLowerCase()=='true'){
			nhom.CmdAdd.disabled= false;
		}			
		else{
			nhom.CmdAdd.disabled= true;		
		}
		nhom.CmdDelete.disabled= false;
		nhom.CmdEdit.disabled= false;
		nhom.CmdSearch.disabled=false;
		nhom.CmdCancel.disabled= true;
		nhom.CmdOK.disabled= true;	
	}
	else {
		nhom.CmdAdd.disabled= true;
		nhom.CmdDelete.disabled= true;
		nhom.CmdEdit.disabled= true;
		nhom.CmdSearch.disabled=true;
		nhom.CmdCancel.disabled= false;
		nhom.CmdOK.disabled= false;
	}	
	nhom.CmdSearch.value="Tì<u>m</u> kiếm";
}

function CmdCancel_onclick() {
	cmdenable(true);
	nhom.CmdDelete.disabled= true;
	nhom.CmdEdit.disabled= true;
	nhom.CheckAdd.checked= false;
	nhom.CheckAdd.disabled= true;
	Lockdata();
	nhom.TxtTochuc.value="";
	nhom.TxtEmail.value="";
	nhom.TxtChucvu.value="";
	nhom.TxtPhone.value="";
	nhom.TxtTen.value="";
}

function Lockdata(){
	nhom.TxtTochuc.disabled=true;
	nhom.TxtPhone.disabled=true;
	nhom.TxtChucvu.disabled=true;
	nhom.TxtTen.disabled=true;
	nhom.TxtEmail.disabled=true;
}
function Unlockdata(){
	nhom.TxtTochuc.disabled=false;
	nhom.TxtPhone.disabled=false;
	nhom.TxtChucvu.disabled=false;
	nhom.TxtTen.disabled=false;
	nhom.TxtEmail.disabled=false;
}
function CmdDelete_onclick() {
	if (nhom.TxtTen.value==""){
		alert("Bạn hãy chọn thông tin cần xoá");
		return ;
	}
	if(!confirm("Bạn có muốn xoá không ?")){
		return false;	
	}
	b="frmcanbodoitac.asp?bma="+"<%=bma%>"+"&bComm=delete";
	window.nhom.target="right";
	window.nhom.action=b;
	window.nhom.submit();
}
function CmdEdit_onclick() {
	if (trim(nhom.TxtTen.value)==""){
		alert("Bạn hãy chọn thông tin cần sửa");
		return ;
	}
	cmdenable(false);
	Unlockdata();
	nhom.sua.value=1;
	nhom.TxtTen.focus();
}
function CmdOK_onclick() {
	if (KTnhap()){
		cmdenable(true);
		if(nhom.sua.value==1){		
			b="frmcanbodoitac.asp?bma="+"<%=bma%>"+"&bComm=edit";					
		}
		else{
			b="frmcanbodoitac.asp?bma="+"<%=bma%>"+"&bComm=add";					
		}
		window.nhom.target="right";
		window.nhom.action=b;
		window.nhom.submit();
	}
}

function CmdLoc_onclick() {
	Unlockdata();
	nhom.TxtTen.focus();
}
function CmdSearch_onclick() {
	nhom.CmdAdd.disabled=true;
	nhom.CmdCancel.disabled=false;
	nhom.CmdEdit.disabled=true;
	nhom.CmdDelete.disabled=true;
	if (nhom.TxtTen.disabled){		
		nhom.CmdSearch.value="Tì<u>m</u>";
		Unlockdata();
		nhom.TxtEmail.value="";
		nhom.TxtChucvu.value="";
		nhom.TxtPhone.value="";
		nhom.TxtTochuc.value="";
		nhom.TxtTen.value="";
		Lockdata();
		nhom.TxtTen.disabled=false;				
		nhom.TxtTen.focus();
		return false;
	}
	blink="frmcanbodoitac.asp?bComm=search";
	window.nhom.action=blink;
	window.nhom.target="right"
	window.nhom.submit();	
}
</script>
<LINK href="../styles/styles.css" type=text/css rel=STYLESHEET>
<body  bgcolor=#F8F9D9 topmargin="0" leftmargin="0" style="font-family:times new roman" onload="SetFocus()">
<form name="nhom" method="post">
<input type=hidden name=sua>
<p align=center><b><font FACE="Times New Roman" size="3">CẬP NHẬT ĐỐI TÁC CÁ NHÂN</font></b>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0"  bgcolor="#BDD5D0" bordercolor="#111111">

<% if CheckAdd="ON" then %>
  <tr>
	<td width="17%"><Button disabled name="CmdAdd" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdAdd_onclick()" accesskey="T"><U>T</U>hêm</Button></td>
    <td width="17%"><Button disabled name="CmdDelete" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><U>X</U>óa</Button></td>
    <td width="17%"><Button disabled name="CmdEdit" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><U>S</U>ửa</Button></td>
    <td width="17%"><Button name="CmdOK" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdOK_onclick()" accesskey="G"><P><U>G</U>hi nhận</P></Button></td>
    <td width="16%"><Button name="CmdCancel" style="FONT-FAMILY: Arial; width:100%" LANGUAGE=javascript onclick="return CmdCancel_onclick()" accesskey="B"><P><U>B</U>ỏ qua</P></Button></td>
    <td width="16%"><Button disabled name="CmdSearch" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdSearch_onclick()" accesskey="M"><P>Tì<u>m</u> kiếm</P></Button></td>
   </tr>
</table>
<table width="100%" border="0" cellspacing="0"  style="Font-family:Times new roman;font-size:12pt;BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: none;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0"  bordercolor="#111111" bgcolor="#BDD5D0">
  <tr>  	
    <td width="12%" >&nbsp;Tên</td>
    <td width="38%" >
    <input maxLength=50 name="TxtTen" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
    <td width="10%" align="center">Phone</td>
    <td width="40%" colspan=2>
    <input maxLength="20" name="TxtPhone" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
  </tr>
  <tr >
    <td width="12%" >&nbsp;Chức vụ</td>
    <td width="38%">
    <input maxLength=100 name="TxtChucvu" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
    <td width="12%" align="center">E-Mail</td>
    <td width="40%" colspan=2>
    <input maxLength=50 name="TxtEmail" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
  </tr>
  <tr >
  	<td width="12%">&nbsp;Tổ chức</td>
  	<td width="68%" colspan=3>
    <input maxLength="255" name="TxtTochuc" style="FONT-FAMILY: Arial; float:left;width:100%" size="20"></td>
	<td width="20%" align=center><label for=C1 accesskey="h">T<u>h</u>êm liên tục </label><input type="checkbox" name="CheckAdd" value="ON" checked id=C1></td>
  </tr>
</table>
<% else %>		<!-- if CheckAdd<>"ON"-->
  <tr>
	<% if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin")  then	%>
    <td width="17%"><Button name="CmdAdd" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdAdd_onclick()" accesskey="T"><u>T</u>hêm</Button></td>
    <%if bComm<>"display" then %>
    <td width="17%"><Button disabled name="CmdDelete" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><u>X</u>óa</Button></td>
    <td width="17%"><Button disabled name="CmdEdit" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><u>S</u>ửa</Button></td>
    <%else%>
    <td width="17%"><Button name="CmdDelete" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><u>X</u>óa</Button></td>
    <td width="17%"><Button name="CmdEdit" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><u>S</u>ửa</Button></td>
    <%end if%>
    <td width="17%"><Button name="CmdOK" disabled style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdOK_onclick()" accesskey="G"><p><u>G</u>hi nhận</p></Button></td>
    <td width="16%"><Button name="CmdCancel" disabled style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdCancel_onclick()" accesskey="B"><p><u>B</u>ỏ qua</p></Button></td>
    <td width="16%"><Button name="CmdSearch" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdSearch_onclick()" accesskey="M"><p>Tì<u>m</u> kiếm</p></Button></td>
    <%else%>
    <td width="17%"><Button disabled name="CmdAdd" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdAdd_onclick()" accesskey="T"><u>T</u>hêm</Button></td>
    <td width="17%"><Button disabled name="CmdDelete" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><u>X</u>óa</Button></td>
    <td width="17%"><Button disabled name="CmdEdit" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><u>S</u>ửa</Button></td>
    <td width="17%"><Button name="CmdOK" disabled style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdOK_onclick()" accesskey="G"><p><u>G</u>hi nhận</p></Button></td>
    <td width="16%"><Button name="CmdCancel" disabled style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdCancel_onclick()" accesskey="B"><p><u>B</u>ỏ qua</p></Button></td>
    <td width="16%"><Button name="CmdSearch" style="FONT-FAMILY: Arial;width:100%" LANGUAGE=javascript onclick="return CmdSearch_onclick()" accesskey="M"><p>Tì<u>m</u> kiếm</p></Button></td>
    <%end if%>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0"  style="Font-family:Times new roman;font-size:12pt;BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: none;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0"  bordercolor="#111111" bgcolor="#BDD5D0">
<% if bcomm="display" then %>
  <tr>  	
    <td width="12%" >&nbsp;Tên</td>
    <td width="38%" >
    <input disabled maxLength=50 VALUE="<%=bTen%>" name="TxtTen" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
    <td width="12%" align="center">Phone</td>
    <td width="40%" colspan=2>
    <input disabled maxLength="20" name="TxtPhone" VALUE="<%=bPhone%>" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
  </tr>
  <tr >
    <td width="12%" >&nbsp;Chức vụ</td>
    <td width="38%">
    <input disabled maxLength=100 name="TxtChucvu" VALUE="<%=bChucvu%>" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
    <td width="12%" align="center">E-Mail</td>
    <td width="40%" colspan=2>
    <input disabled maxLength=50 name="TxtEmail" VALUE="<%=bEmail%>" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
  </tr>
  <tr >
  	<td width="12%">&nbsp;Tổ chức</td>
  	<td width="68%" colspan=3>
    <input disabled  maxLength="255" name="TxtTochuc" VALUE="<%=bTochuc%>" style="FONT-FAMILY: Arial; float:left;width:100%" size="20"></td>
	<td width="20%" align=center><label for=C1 accesskey="h">T<u>h</u>êm liên tục </label><input type="checkbox" name="CheckAdd" value="ON" disabled id=C1></td>
  </tr>
  <%else%>
  <tr>
    <td width="12%">&nbsp;Tên</td>
    <td width="38%">
    <input disabled maxLength=50 name="TxtTen" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
    <td width="12%" align="center">Phone</td>
    <td width="40%" colspan=2>
    <input disabled maxLength="20" name="TxtPhone" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
  </tr>
  <tr>
    <td width="12%" >&nbsp;Chức vụ</td>
    <td width="38%">
    <input disabled maxLength=100 name="TxtChucvu" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
    <td width="12%" align="center">E-Mail</td>
    <td width="40%" colspan=2>
    <input disabled maxLength=50 name="TxtEmail" style="FONT-FAMILY: Arial;width:100%" size="20"></td>
  </tr>
  <tr>
  	<td width="12%">&nbsp;Tổ chức</td>
  	<td width="68%" colspan=3> 
    <input maxLength="255" disabled  name="TxtTochuc" style="FONT-FAMILY: Arial; float:left;width:100%" size="20"></td>
	<td width="20%" align=center><label for=C1 accesskey="h">T<u>h</u>êm liên tục </label><input type="checkbox" name="CheckAdd" value="ON" disabled id=C1></td>	
   </tr> 
 <%end if%>
</table>
<% end if %>		<!-- end if CheckAdd="ON"-->

<table WIDTH= "100%" border="0" style="Font-family:Times new roman;font-size:12pt;BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: none;Border-color:#C0C0C0" >
  <tr>
    <td width="100%" colspan="3" bgcolor="#173584" align="center"><b><font color="#FFFFFF" size="2">DANH SÁCH ĐỐI TÁC CÁ NHÂN</font></b></td>
  </tr>
  <tr>
    <td width="40%" bgcolor="#BDD5D0" align="center"><b>Tên</b></td>
    <td width="30%" bgcolor="#BDD5D0" align="center"><b>Điện thoại</b></td>
    <td width="30%" bgcolor="#BDD5D0" align="center"><b>E-Mail</b></td>
  </tr>
  <%	
	If Not Rec.Eof Then
		nRecCount = Rec.RecordCount
		Rec.PageSize = 20
		nPageCount = Rec.PageCount
		If nPage < 1 then
			nPage = 1			
		End If
		if nPage > nPageCount Then
			nPage=nPageCount
		end if
		cnt=(pg-1)*pgsize + 1		    
		STT=1
		rec.AbsolutePage=nPage
		howmanyrecs=0
		do while not Rec.EOF and howmanyrecs<rec.PageSize
			if (cnt/2=int(cnt/2)) then
				color="#eeeecc"
			else
				color="#F8F9D9"
			end if
			bTen=server.URLEncode(trim(Rec("Ten")))
			bChucvu=server.URLEncode(trim(Rec("chucvu")))
			bChucvu=server.URLEncode(trim(Rec("thuocTochuc")))
			bEmail=server.URLEncode(trim(Rec("Email")))
			bPhone=server.URLEncode(trim(Rec("Phone")))
%>  
  <tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>" onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
    <td width="40%"><font face="Time New Roman"><a style='text-decoration: none;color:blue' href='frmcanbodoitac.asp?page=<%=nPage%>&bComm=display&bma=<%=Rec("IdDoitac")%>'>
    &nbsp;<%=Rec("Ten")%></a></font></td>
    <td width="30%"><font face="Time New Roman"><a style='text-decoration: none;color:blue' href='frmcanbodoitac.asp?page=<%=nPage%>&bComm=display&bma=<%=Rec("IdDoitac")%>'>
    &nbsp;<%=Rec("Phone")%></a></font></td>
    <td width="30%"><font face="Time New Roman"><a style='text-decoration: none;color:blue' href='frmcanbodoitac.asp?page=<%=nPage%>&bComm=display&bma=<%=Rec("IdDoitac")%>'>
    &nbsp;<%=Rec("Email")%></a></font></td>
  </tr>
<%			STT=STT+1
			Rec.MoveNext
			cnt=cnt+1
			howmanyrecs=howmanyrecs+1
		loop
	end if
	rec.Close
	set rec=nothing
	
%>
</table>  
<br>
<table width="98%" cellspacing=0 cellpadding=0>
<tr>
<% if nPage > 0 and nPageCount >0  then %>  
	<td width="20%"><b>Trang&nbsp; <%=nPage%>/<%=nPageCount%></b></td>
<!-- 	<td width= "80%" align="right">
	<% if nPageCount > 1 then %>    
		Chuyển nhanh tới trang:&nbsp;
		<select name="page" style="width:45;height:23;font-size:8pt" size=1 onchange="javaScript:ChangePage()">
			<% for i = 1 to nPageCount%>	
				<% if bComm<>"search"  then
					strURL="frmdoitac.asp?bsearch="& bsearch &"&Loaitim="& loaitim &"&page="+ cstr(i) + "&bComm="
				else
					strURL="frmdoitac.asp?bsearch="& bsearch &"&Loaitim="& loaitim &"&page="+ cstr(i) + "&bComm=search"
				end if %>
				<option value="<%=strURL%>" <%=chkSelected(i, nPage)%>><%=i%></option>
			<% next %>    
		</select>
		</td>                                  
	<% end if %>              -->
<% 'else %>
<% end if %>
<td width= "80%" align="center"><%=Paging(nPage, nPageCount, nRecCount)%></td>
</tr>
</table>
<%
	Conn.Close
	Set Conn=nothing
	set ClsFun=nothing
%>
</form>
</body>
</html>